package sdw.ufal.p3.persistence;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;

import sdw.ufal.p3.entity.Decisao;
import sdw.ufal.p3.entity.Processo;

import gov.tjpr.persistence.hibernate.AbstractHibernateDAO;

@SuppressWarnings("serial")
public class DecisaoDAOImpl extends AbstractHibernateDAO<Decisao, Long> implements DecisaoDAO{

	@SuppressWarnings("unchecked")
	@Override
	public List<Decisao> findAllByProcesso(Processo processo) {
		List<Decisao> list = new ArrayList<Decisao>();
		StringBuffer sb = new StringBuffer();
		sb.append("select d from Decisao d join d.processo p where p.idProcesso = ").append(processo.getId());
		Query q = getSession().createQuery(sb.toString());
		list = q.list();
		return list;
	}
	

}
